project(IotIpc)
cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions("-Wall -Os -fno-strict-aliasing -rdynamic -funwind-tables -ffunction-sections -fdata-sections")
set(LINK_FLAGS "-Wl,--gc-sections")
set(CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS    "${LINK_FLAGS}")

include(${PROJECT_SOURCE_DIR}/Cmake/CmakeFunction.cmake)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

set(CommonPath ${PROJECT_SOURCE_DIR}/InCommon)
set(ApplicationPath ${PROJECT_SOURCE_DIR}/Application)
set(PeripheralPath ${PROJECT_SOURCE_DIR}/Peripheral)
set(ChipSdkPath ${PROJECT_SOURCE_DIR}/ChipSdk)
set(InSdkPath ${PROJECT_SOURCE_DIR}/InSdk)
set(OSCPath ${PROJECT_SOURCE_DIR}/OpenSourceCode)
set(DefPath ${PROJECT_SOURCE_DIR}/ProDefine)

include(${DefPath}/CMakeLists.txt)

Cmake_include_dir(${CommonPath})
Cmake_include_dir(${PROJECT_SOURCE_DIR}/IotSdk/${IOT_TYPE}/include)

include_directories(${ApplicationPath}/${IOT_TYPE})
link_directories(${PROJECT_SOURCE_DIR}/InSdk/libs/${CHIP_TYPE})

add_subdirectory(OpenSourceCode)
add_subdirectory(InCommon)
add_subdirectory(ChipSdk)
add_subdirectory(IotSdk)
add_subdirectory(InSdk)
add_subdirectory(Peripheral)
add_subdirectory(Application)

link_directories(${Com_cache_lib})
include_directories(${Com_cache_head})

add_executable(iot_ipc ${cache_main_src})
target_link_libraries(iot_ipc pthread rt dl m ${IOT_cache_lib} ${OSC_cache_lib} ${Add_func_cache_lib} ${Per_cache_lib} ${InSDK_cache_lib} ${ChipSdk_cache_lib} ${InCom_cache_lib})
